<div class="bg-light lter b-b wrapper-md ng-scope">
    <h4 class="m-n font-thin">商户管理</h4>
</div>
<div class="ng-scope" ng-controller="merchantsCtrl">
    <script type="text/ng-template" id="updateUserStatus.html">
        <div ng-include="'tpl/systemSetting/merchants_update_status.html'"></div>
    </script>
    <script type="text/ng-template" id="merchantsAudit.html">
        <div ng-include="'tpl/systemSetting/merchants_audit.html'"></div>
    </script>
    <tabset class="tab-container wrapper">
        <tab heading="平台商户" ng-click="changeType(0)">
            <div class="panel panel-default">
                <div class="wrapper panel-body m-b-sm padder-v">
                    <div class="col-sm-9">
                        <form class="form-inline">
                            <div class="form-group block m-t-sm">
                                <div class="form-group">
                                    <label class="control-label">店铺名称</label>
                                    <input type="text" ng-model="shop.name" class="input-sm form-control">
                                </div>
                                <label class="control-label">状态</label>
                                <select class="input-sm form-control" ng-model="shop.auditStatus"
                                        ng-options="item.value as item.name for item in auditStatusObject">
                                    <option value="">全部</option>
                                </select>
                            </div>
                            <button class="btn btn-sm btn-info" ng-click="query()">查询</button>
                        </form>
                    </div>
                </div>
                <div class="table-responsive" ng-controller="updateMerchantsCtrl">
                    <table class="table table-striped b-t b-light">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>联系方式</th>
                            <th>行业</th>
                            <th>让利值(%)</th>
                            <th>套餐</th>
                            <th>经营类型</th>
                            <th>状态</th>
                            <th>账户状态</th>
                            <th>审核状态</th>
                            <th>近期是否调整</th>
                            <th>到期时间</th>
                            <th width="200" class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="m in list">
                            <td>{{m.name}}</td>
                            <td>
                                <span>联系人:{{m.linkman}}</span><br>
                                <span>联系电话:{{m.mobilePhone}}</span><br>
                                <span ng-if="m.address != 'null' && m.address != null && m.address != ''">地址:{{m.address}}</span>
                            </td>
                            <td>{{m.industryName}}</td>
                            <td>{{m.profit}}</td>
                            <td>{{m.setMealName}}</td>
                            <td>
                                <span ng-if="m.isMail == 1">直邮<br></span>
                                <span ng-if="m.isShop == 1">到店<br></span>
                                <span ng-if="m.isDelivery == 1">配送<br></span>
                                <span ng-if="m.isEat == 1">堂食<br></span>
                                <span ng-if="m.isReserve == 1">预定</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.status == 0">营业中</span>
                                <span class="badge bg-danger" ng-if="m.status == 1">休息中</span>
                                <span class="badge bg-danger" ng-if="m.status == 2">停业整顿</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.systemUserStatus == 0">正常</span>
                                <span class="badge bg-danger" ng-if="m.systemUserStatus == 1">冻结</span>
                            </td>
                            <td>
                                <span class="badge bg-danger" ng-if="m.auditStatus == 0">待审核</span>
                                <span class="badge bg-danger" ng-if="m.auditStatus == 1">审核不通过</span>
                                <span class="badge bg-success" ng-if="m.auditStatus == 2">审核通过</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.isRecentChange == 0">暂无调整</span>
                                <span class="badge bg-warning" ng-if="m.isRecentChange == 1">近期调整</span>
                            </td>
                            <td>{{m.expireTime.split(" ")[0]}}</td>
                            <td class="t-btns text-left">
                                <a class="btn btn-sm btn-success" ui-sref="app.merchantsView({shopId:m.shopId})"
                                   target="_blank">查看</a>
                                <button class="btn btn-sm btn-info" ui-sref="app.merchantsEdit({shopId:m.shopId})"
                                        ng-if="m.isChain==0">修改
                                </button>
                                <div class="btn-group dropdown" dropdown="">
                                    <button class="btn btn-sm btn-default" dropdown-toggle=""
                                            aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu">
                                        <li><a href="" ui-sref="app.merchantsGoods({shopId:m.shopId})" target="_blank">查看商品</a>
                                        </li>
                                        <li>
                                            <a ng-click="openUpdateStatus(m.shopId,1,m.name)"
                                               ng-if="m.systemUserStatus == 0">冻结账户</a>
                                            <a ng-click="openUpdateStatus(m.shopId,0,m.name)"
                                               ng-if="m.systemUserStatus == 1">解冻账户</a>
                                        </li>
                                        <li><a ng-click="openMerchantsAudit(m.shopId,m.name,2,m.isSetType)"
                                               ng-if="m.auditStatus == 0 || m.auditStatus==1">审核通过</a></li>
                                        <li><a ui-sref="app.merchantsAuditFail({id:m.shopId})"
                                               ng-if="m.auditStatus == 0">审核不通过</a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                        <span class="h6">~未搜索到任何数据~</span>
                    </div>
                    <div>
                        <circle-loading ng-if="app.loading"></circle-loading>
                    </div>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="col-sm-4 hidden-xs">
                            <!--<div class="pull-left">-->
                            <!--<button class="btn btn-sm btn-info">批量打印小票</button>-->
                            <!--</div>-->
                        </div>
                        <div class="col-sm-4 text-center">
                            <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                        </div>
                        <div class="col-sm-4 text-right text-center-xs">
                            <pagination boundary-links="true" total-items="totalItems" ng-model="page.currentPage"
                                        ng-change="replacePage()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                        previous-text="上一页" next-text="下一页"
                                        first-text="首页" last-text="尾页"></pagination>

                        </div>
                    </div>
                </footer>
            </div>
        </tab>
        <tab heading="品牌商户" ng-click="changeType(1)">
            <div class="panel panel-default">
                <div class="wrapper panel-body m-b-sm padder-v">
                    <div class="col-sm-9">
                        <form class="form-inline">
                            <div class="form-group block m-t-sm">
                                <div class="form-group">
                                    <label class="control-label">店铺名称</label>
                                    <input type="text" ng-model="shop.name" class="input-sm form-control">
                                </div>
                                <label class="control-label">状态</label>
                                <select class="input-sm form-control" ng-model="shop.auditStatus"
                                        ng-options="item.value as item.name for item in auditStatusObject">
                                    <option value="">全部</option>
                                </select>
                            </div>
                            <button class="btn btn-sm btn-info" ng-click="query()">查询</button>
                        </form>
                    </div>
                </div>
                <div class="table-responsive" ng-controller="updateMerchantsCtrl">
                    <table class="table table-striped b-t b-light">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>联系方式</th>
                            <th>行业</th>
                            <th>让利值(%)</th>
                            <th>套餐</th>
                            <th>经营类型</th>
                            <th>状态</th>
                            <th>账户状态</th>
                            <th>审核状态</th>
                            <th>近期是否调整</th>
                            <th>到期时间</th>
                            <th width="200" class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="m in list">
                            <td>{{m.name}}</td>
                            <td>
                                <span>联系人:{{m.linkman}}</span><br>
                                <span>联系电话:{{m.mobilePhone}}</span><br>
                                <span ng-if="m.address != 'null' && m.address != null && m.address != ''">地址:{{m.address}}</span>
                            </td>
                            <td>{{m.industryName}}</td>
                            <td>{{m.profit}}</td>
                            <td>{{m.setMealName}}</td>
                            <td>
                                <span ng-if="m.isMail == 1">直邮<br></span>
                                <span ng-if="m.isShop == 1">到店<br></span>
                                <span ng-if="m.isDelivery == 1">配送<br></span>
                                <span ng-if="m.isEat == 1">堂食<br></span>
                                <span ng-if="m.isReserve == 1">预定</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.status == 0">营业中</span>
                                <span class="badge bg-danger" ng-if="m.status == 1">休息中</span>
                                <span class="badge bg-danger" ng-if="m.status == 2">停业整顿</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.systemUserStatus == 0">正常</span>
                                <span class="badge bg-danger" ng-if="m.systemUserStatus == 1">冻结</span>
                            </td>
                            <td>
                                <span class="badge bg-danger" ng-if="m.auditStatus == 0">待审核</span>
                                <span class="badge bg-danger" ng-if="m.auditStatus == 1">审核不通过</span>
                                <span class="badge bg-success" ng-if="m.auditStatus == 2">审核通过</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.isRecentChange == 0">暂无调整</span>
                                <span class="badge bg-warning" ng-if="m.isRecentChange == 1">近期调整</span>
                            </td>
                            <td>{{m.expireTime.split(" ")[0]}}</td>
                            <td class="t-btns text-left">
                                <a class="btn btn-sm btn-success" ui-sref="app.merchantsView({shopId:m.shopId})"
                                   target="_blank">查看</a>
                                <button class="btn btn-sm btn-info" ui-sref="app.merchantsEdit({shopId:m.shopId})"
                                        ng-if="m.isChain==0">修改
                                </button>
                                <div class="btn-group dropdown" dropdown="">
                                    <button class="btn btn-sm btn-default" dropdown-toggle=""
                                            aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu">
                                        <li><a href="" ui-sref="app.merchantsGoods({shopId:m.shopId})" target="_blank">查看商品</a>
                                        </li>
                                        <li>
                                            <a ng-click="openUpdateStatus(m.shopId,1,m.name)"
                                               ng-if="m.systemUserStatus == 0">冻结账户</a>
                                            <a ng-click="openUpdateStatus(m.shopId,0,m.name)"
                                               ng-if="m.systemUserStatus == 1">解冻账户</a>
                                        </li>
                                        <li><a ng-click="openMerchantsAudit(m.shopId,m.name,2,m.isSetType)"
                                               ng-if="m.auditStatus == 0 || m.auditStatus==1">审核通过</a></li>
                                        <li><a ui-sref="app.merchantsAuditFail({id:m.shopId})"
                                               ng-if="m.auditStatus == 0">审核不通过</a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                        <span class="h6">~未搜索到任何数据~</span>
                    </div>
                    <div>
                        <circle-loading ng-if="app.loading"></circle-loading>
                    </div>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="col-sm-4 hidden-xs">
                            <!--<div class="pull-left">-->
                            <!--<button class="btn btn-sm btn-info">批量打印小票</button>-->
                            <!--</div>-->
                        </div>
                        <div class="col-sm-4 text-center">
                            <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                        </div>
                        <div class="col-sm-4 text-right text-center-xs">
                            <pagination boundary-links="true" total-items="totalItems" ng-model="page.currentPage"
                                        ng-change="replacePage()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                        previous-text="上一页" next-text="下一页"
                                        first-text="首页" last-text="尾页"></pagination>

                        </div>
                    </div>
                </footer>
            </div>
        </tab>
        <tab heading="小程序" ng-click="changeType(2)">
            <div class="panel panel-default">
                <div class="wrapper panel-body m-b-sm padder-v">
                    <div class="col-sm-9">
                        <form class="form-inline">
                            <div class="form-group block m-t-sm">
                                <div class="form-group">
                                    <label class="control-label">店铺名称</label>
                                    <input type="text" ng-model="shop.name" class="input-sm form-control">
                                </div>
                                <label class="control-label">状态</label>
                                <select class="input-sm form-control" ng-model="shop.auditStatus"
                                        ng-options="item.value as item.name for item in auditStatusObject">
                                    <option value="">全部</option>
                                </select>
                            </div>
                            <button class="btn btn-sm btn-info" ng-click="query()">查询</button>
                        </form>
                    </div>
                </div>
                <div class="table-responsive" ng-controller="updateMerchantsCtrl">
                    <table class="table table-striped b-t b-light">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>联系方式</th>
                            <th>行业</th>
                            <th>让利值(%)</th>
                            <th>套餐</th>
                            <th>经营类型</th>
                            <th>状态</th>
                            <th>账户状态</th>
                            <th>审核状态</th>
                            <th>近期是否调整</th>
                            <th>到期时间</th>
                            <th width="200" class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="m in list">
                            <td>{{m.name}}</td>
                            <td>
                                <span>联系人:{{m.linkman}}</span><br>
                                <span>联系电话:{{m.mobilePhone}}</span><br>
                                <span ng-if="m.address != 'null' && m.address != null && m.address != ''">地址:{{m.address}}</span>
                            </td>
                            <td>{{m.industryName}}</td>
                            <td>{{m.profit}}</td>
                            <td>{{m.setMealName}}</td>
                            <td>
                                <span ng-if="m.isMail == 1">直邮<br></span>
                                <span ng-if="m.isShop == 1">到店<br></span>
                                <span ng-if="m.isDelivery == 1">配送<br></span>
                                <span ng-if="m.isEat == 1">堂食<br></span>
                                <span ng-if="m.isReserve == 1">预定</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.status == 0">营业中</span>
                                <span class="badge bg-danger" ng-if="m.status == 1">休息中</span>
                                <span class="badge bg-danger" ng-if="m.status == 2">停业整顿</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.systemUserStatus == 0">正常</span>
                                <span class="badge bg-danger" ng-if="m.systemUserStatus == 1">冻结</span>
                            </td>
                            <td>
                                <span class="badge bg-danger" ng-if="m.auditStatus == 0">待审核</span>
                                <span class="badge bg-danger" ng-if="m.auditStatus == 1">审核不通过</span>
                                <span class="badge bg-success" ng-if="m.auditStatus == 2">审核通过</span>
                            </td>
                            <td>
                                <span class="badge bg-success" ng-if="m.isRecentChange == 0">暂无调整</span>
                                <span class="badge bg-warning" ng-if="m.isRecentChange == 1">近期调整</span>
                            </td>
                            <td>{{m.expireTime.split(" ")[0]}}</td>
                            <td class="t-btns text-left">
                                <a class="btn btn-sm btn-success" ui-sref="app.merchantsView({shopId:m.shopId})"
                                   target="_blank">查看</a>
                                <button class="btn btn-sm btn-info" ui-sref="app.merchantsEdit({shopId:m.shopId})"
                                        ng-if="m.isChain==0">修改
                                </button>
                                <div class="btn-group dropdown" dropdown="">
                                    <button class="btn btn-sm btn-default" dropdown-toggle=""
                                            aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu">
                                        <li><a href="" ui-sref="app.merchantsGoods({shopId:m.shopId})" target="_blank">查看商品</a>
                                        </li>
                                        <li>
                                            <a ng-click="openUpdateStatus(m.shopId,1,m.name)"
                                               ng-if="m.systemUserStatus == 0">冻结账户</a>
                                            <a ng-click="openUpdateStatus(m.shopId,0,m.name)"
                                               ng-if="m.systemUserStatus == 1">解冻账户</a>
                                        </li>
                                        <li><a ng-click="openMerchantsAudit(m.shopId,m.name,2,m.isSetType)"
                                               ng-if="m.auditStatus == 0 || m.auditStatus==1">审核通过</a></li>
                                        <li><a ui-sref="app.merchantsAuditFail({id:m.shopId})"
                                               ng-if="m.auditStatus == 0">审核不通过</a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                        <span class="h6">~未搜索到任何数据~</span>
                    </div>
                    <div>
                        <circle-loading ng-if="app.loading"></circle-loading>
                    </div>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="col-sm-4 hidden-xs">
                            <!--<div class="pull-left">-->
                            <!--<button class="btn btn-sm btn-info">批量打印小票</button>-->
                            <!--</div>-->
                        </div>
                        <div class="col-sm-4 text-center">
                            <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                        </div>
                        <div class="col-sm-4 text-right text-center-xs">
                            <pagination boundary-links="true" total-items="totalItems" ng-model="page.currentPage"
                                        ng-change="replacePage()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                        previous-text="上一页" next-text="下一页"
                                        first-text="首页" last-text="尾页"></pagination>

                        </div>
                    </div>
                </footer>
            </div>
        </tab>
    </tabset>
</div>

